using System.Reflection;
using System.Configuration;
using System.Transactions;
using System;
using KPIS.GERP.GIMS.IDAL;
using KPIS.GERP.GIMS.DAL;

namespace KPIS.GERP.GIMS.DALFactory
{
    public sealed class DataAccess
    {
        private static readonly string path = ConfigurationManager.AppSettings["WebDAL"];

        private DataAccess()
        {

        }

        public static IDALTree CreateTree()
        {
            string className = path + ".TreeDAL";
            return (IDALTree)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALDocument CreateDocument()
        {
            string className = path + ".DocumentDAL";
            return (IDALDocument)Assembly.Load(path).CreateInstance(className);
        }

        //---------------------------------- MASTER ----------------------------------------------------

        public static IDALMasterPurchaseRule CreateMasterPurchaseRule()
        {
            string className = path + ".MasterPurchaseRuleDAL";
            return (IDALMasterPurchaseRule)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterPurchaseRuleMapping CreateMasterPurchaseRuleMapping()
        {
            string className = path + ".MasterPurchaseRuleMappingDAL";
            return (IDALMasterPurchaseRuleMapping)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALResourceMasterType CreateResourceMasterType()
        {
            string className = path + ".ResourceMasterTypeDAL";
            return (IDALResourceMasterType)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALResourceMasterGroup CreateResourceMasterGroup()
        {
            string className = path + ".ResourceMasterGroupDAL";
            return (IDALResourceMasterGroup)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALResourceMasterSubGroup CreateResourceMasterSubGroup()
        {
            string className = path + ".ResourceMasterSubGroupDAL";
            return (IDALResourceMasterSubGroup)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALResourceMasterItem CreateResourceMasterItem()
        {
            string className = path + ".ResourceMasterItemDAL";
            return (IDALResourceMasterItem)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterUnit CreateMasterUnit()
        {
            string className = path + ".MasterUnitDAL";
            return (IDALMasterUnit)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterWarehouse CreateMasterWarehouse()
        {
            string className = path + ".MasterWarehouseDAL";
            return (IDALMasterWarehouse)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterWarehouseConsume CreateMasterWarehouseConsume()
        {
            string className = path + ".MasterWarehouseConsumeDAL";
            return (IDALMasterWarehouseConsume)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterPurchaseMethod CreateMasterPurchaseMethod()
        {
            string className = path + ".MasterPurchaseMethodDAL";
            return (IDALMasterPurchaseMethod)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterPurchaseType CreateMasterPurchaseType()
        {
            string className = path + ".MasterPurchaseTypeDAL";
            return (IDALMasterPurchaseType)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterPurchaseMapping CreateMasterPurchaseMapping()
        {
            string className = path + ".MasterPurchaseMappingDAL";
            return (IDALMasterPurchaseMapping)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterCommitteeFunction CreateMasterCommitteeFunction()
        {
            string className = path + ".MasterCommitteeFunctionDAL";
            return (IDALMasterCommitteeFunction)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterCommitteePosition CreateMasterCommitteePosition()
        {
            string className = path + ".MasterCommitteePositionDAL";
            return (IDALMasterCommitteePosition)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterCommitteeMapping CreateMasterCommitteeMapping()
        {
            string className = path + ".MasterCommitteeMappingDAL";
            return (IDALMasterCommitteeMapping)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterContact CreateMasterContact()
        {
            string className = path + ".MasterContactDAL";
            return (IDALMasterContact)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterContactBank CreateMasterContactBank()
        {
            string className = path + ".MasterContactBankDAL";
            return (IDALMasterContactBank)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALMasterContactPartner CreateMasterContactPartner()
        {
            string className = path + ".MasterContactPartnerDAL";
            return (IDALMasterContactPartner)Assembly.Load(path).CreateInstance(className);
        }

        public static MasterDepreciationTypeDAL CreateMasterDepreciationType()
        {
            string className = path + ".MasterDepreciationTypeDAL";
            return (MasterDepreciationTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        //----------------------------------------------------------------------------------------------------

        //---------------------------------- PURCHASE ----------------------------------------------------------

        public static IDALPrePurchaseRequest CreatePrePurchaseRequest()
        {
            string className = path + ".PrePurchaseRequestDAL";
            return (IDALPrePurchaseRequest)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPrePurchaseRequestItem CreatePrePurchaseRequestItem()
        {
            string className = path + ".PrePurchaseRequestItemDAL";
            return (IDALPrePurchaseRequestItem)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPrePurchaseRequestCommittee CreatePrePurchaseRequestCommittee()
        {
            string className = path + ".PrePurchaseRequestCommitteeDAL";
            return (IDALPrePurchaseRequestCommittee)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALProgressPrePurchaseRequest CreateProgressPrePurchaseRequest()
        {
            string className = path + ".ProgressPrePurchaseRequestDAL";
            return (IDALProgressPrePurchaseRequest)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPrePurchaseRequestReject CreatePrePurchaseRequestReject()
        {
            string className = path + ".PrePurchaseRequestRejectDAL";
            return (IDALPrePurchaseRequestReject)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPrePurchaseRequestRoute CreatePrePurchaseRequestRoute()
        {
            string className = path + ".PrePurchaseRequestRouteDAL";
            return (IDALPrePurchaseRequestRoute)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPrePurchaseRequestRouteHistory CreatePrePurchaseRequestRouteHistory()
        {
            string className = path + ".PrePurchaseRequestRouteHistoryDAL";
            return (IDALPrePurchaseRequestRouteHistory)Assembly.Load(path).CreateInstance(className);
        }

        public static BidDAL CreateBid()
        {
            string className = path + ".BidDAL";
            return (BidDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseRequestDAL CreatePurchaseRequest()
        {
            string className = path + ".PurchaseRequestDAL";
            return (PurchaseRequestDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static CollectRequestDAL CreateCollectRequest()
        {
            string className = path + ".CollectRequestDAL";
            return (CollectRequestDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseRequestItemDAL CreatePurchaseRequestItem()
        {
            string className = path + ".PurchaseRequestItemDAL";
            return (PurchaseRequestItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ProgressPurchaseRequestDAL CreateProgressPurchaseRequest()
        {
            string className = path + ".ProgressPurchaseRequestDAL";
            return (ProgressPurchaseRequestDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseRequestCommitteeDAL CreatePurchaseRequestCommittee()
        {
            string className = path + ".PurchaseRequestCommitteeDAL";
            return (PurchaseRequestCommitteeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static BidderDAL CreateBidder()
        {
            string className = path + ".BidderDAL";
            return (BidderDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static BidderQuotationDAL CreateBidderQuotation()
        {
            string className = path + ".BidderQuotationDAL";
            return (BidderQuotationDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderDAL CreatePurchaseOrder()
        {
            string className = path + ".PurchaseOrderDAL";
            return (PurchaseOrderDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderCommitteeDAL CreatePurchaseOrderCommittee()
        {
            string className = path + ".PurchaseOrderCommitteeDAL";
            return (PurchaseOrderCommitteeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderPenaltyDAL CreatePurchaseOrderPenalty()
        {
            string className = path + ".PurchaseOrderPenaltyDAL";
            return (PurchaseOrderPenaltyDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderItemDAL CreatePurchaseOrderItem()
        {
            string className = path + ".PurchaseOrderItemDAL";
            return (PurchaseOrderItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderInstallmentDAL CreatePurchaseOrderInstallment()
        {
            string className = path + ".PurchaseOrderInstallmentDAL";
            return (PurchaseOrderInstallmentDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderInstallmentItemDAL CreatePurchaseOrderInstallmentItem()
        {
            string className = path + ".PurchaseOrderInstallmentItemDAL";
            return (PurchaseOrderInstallmentItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ProgressPurchaseOrderDAL CreateProgressPurchaseOrder()
        {
            string className = path + ".ProgressPurchaseOrderDAL";
            return (ProgressPurchaseOrderDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderRouteDAL CreatePurchaseOrderRoute()
        {
            string className = path + ".PurchaseOrderRouteDAL";
            return (PurchaseOrderRouteDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderRouteHistoryDAL CreatePurchaseOrderRouteHistory()
        {
            string className = path + ".PurchaseOrderRouteHistoryDAL";
            return (PurchaseOrderRouteHistoryDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static BidCommitteeDAL CreateBidCommittee()
        {
            string className = path + ".BidCommitteeDAL";
            return (BidCommitteeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static BidderCollateralDAL CreateBidderCollateral()
        {
            string className = path + ".BidderCollateralDAL";
            return (BidderCollateralDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static PurchaseOrderCollateralDAL CreatePurchaseOrderCollateral()
        {
            string className = path + ".PurchaseOrderCollateralDAL";
            return (PurchaseOrderCollateralDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static DeliveryNoteDAL CreateDeliveryNote()
        {
            string className = path + ".DeliveryNoteDAL";
            return (DeliveryNoteDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static DeliveryNoteItemDAL CreateDeliveryNoteItem()
        {
            string className = path + ".DeliveryNoteItemDAL";
            return (DeliveryNoteItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static DeliveryNoteItemExtraDAL CreateDeliveryNoteItemExtra()
        {
            string className = path + ".DeliveryNoteItemExtraDAL";
            return (DeliveryNoteItemExtraDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static DeliveryNoteCommitteeDAL CreateDeliveryNoteCommittee()
        {
            string className = path + ".DeliveryNoteCommitteeDAL";
            return (DeliveryNoteCommitteeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static DeliveryNotePenaltyDAL CreateDeliveryNotePenalty()
        {
            string className = path + ".DeliveryNotePenaltyDAL";
            return (DeliveryNotePenaltyDAL)Assembly.Load(path).CreateInstance(className);
        }

        //----------------------------------------------------------------------------------------------------

        //---------------------------------- SYSTEM ----------------------------------------------------------

        public static IDALSysScope CreateSysScope()
        {
            string className = path + ".SysScopeDAL";
            return (IDALSysScope)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysContactGroup CreateSysContactGroup()
        {
            string className = path + ".SysContactGroupDAL";
            return (IDALSysContactGroup)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysContactStatus CreateSysContactStatus()
        {
            string className = path + ".SysContactStatusDAL";
            return (IDALSysContactStatus)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysVat CreateSysVat()
        {
            string className = path + ".SysVatDAL";
            return (IDALSysVat)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysYearType CreateSysYearType()
        {
            string className = path + ".SysYearTypeDAL";
            return (IDALSysYearType)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysPprType CreateSysPprType()
        {
            string className = path + ".SysPprTypeDAL";
            return (IDALSysPprType)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysRecordStatus CreateSysRecordStatus()
        {
            string className = path + ".SysRecordStatusDAL";
            return (IDALSysRecordStatus)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysProgress CreateSysProgress()
        {
            string className = path + ".SysProgressDAL";
            return (IDALSysProgress)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysPprMethod CreateSysPprMethod()
        {
            string className = path + ".SysPprMethodDAL";
            return (IDALSysPprMethod)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysPprPriority CreateSysPprPriority()
        {
            string className = path + ".SysPprPriorityDAL";
            return (IDALSysPprPriority)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysDurationType CreateSysDurationType()
        {
            string className = path + ".SysDurationTypeDAL";
            return (IDALSysDurationType)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysDurationCount CreateSysDurationCount()
        {
            string className = path + ".SysDurationCountDAL";
            return (IDALSysDurationCount)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALSysPprUseMethod CreateSysPprUseMethod()
        {
            string className = path + ".SysPprUseMethodDAL";
            return (IDALSysPprUseMethod)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALPersonal CreatePersonal()
        {
            string className = path + ".PersonalDAL";
            return (IDALPersonal)Assembly.Load(path).CreateInstance(className);
        }

        public static SysUseMethodDAL CreateSysUseMethod()
        {
            string className = path + ".SysUseMethodDAL";
            return (SysUseMethodDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysPenaltyCountDAL CreateSysPenaltyCount()
        {
            string className = path + ".SysPenaltyCountDAL";
            return (SysPenaltyCountDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysPenaltyRateTypeDAL CreateSysPenaltyRateType()
        {
            string className = path + ".SysPenaltyRateTypeDAL";
            return (SysPenaltyRateTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysControlDAL CreateSysControl()
        {
            string className = path + ".SysControlDAL";
            return (SysControlDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysCollateralTypeDAL CreateSysCollateralType()
        {
            string className = path + ".SysCollateralTypeDAL";
            return (SysCollateralTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysCollateralCategoryDAL CreateSysCollateralCategory()
        {
            string className = path + ".SysCollateralCategoryDAL";
            return (SysCollateralCategoryDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysReportDAL CreateSysReport()
        {
            string className = path + ".SysReportDAL";
            return (SysReportDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static SysReportDataTableDAL CreateSysReportDataTable()
        {
            string className = path + ".SysReportDataTableDAL";
            return (SysReportDataTableDAL)Assembly.Load(path).CreateInstance(className);
        }

        //----------------------------------------------------------------------------------------------------

        //---------------------------------- CONNECT BGM ----------------------------------------------------

        public static IDALBgmSource CreateBgmSource()
        {
            string className = path + ".BgmSourceDAL";
            return (IDALBgmSource)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALBgmRequestExpense CreateBgmRequestExpense()
        {
            string className = path + ".BgmRequestExpenseDAL";
            return (IDALBgmRequestExpense)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALBgmProject CreateBgmProject()
        {
            string className = path + ".BgmProjectDAL";
            return (IDALBgmProject)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALBgmProjectExpense CreateBgmProjectExpense()
        {
            string className = path + ".BgmProjectExpenseDAL";
            return (IDALBgmProjectExpense)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALBgmProjectOperation CreateBgmProjectOperation()
        {
            string className = path + ".BgmProjectOperationDAL";
            return (IDALBgmProjectOperation)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALBgmProjectOperationExpense CreateBgmProjectOperationExpense()
        {
            string className = path + ".BgmProjectOperationExpenseDAL";
            return (IDALBgmProjectOperationExpense)Assembly.Load(path).CreateInstance(className);
        }

        //----------------------------------------------------------------------------------------------------

        //---------------------------------- CONNECT HRM -----------------------------------------------------

        public static IDALHrmScope CreateHrmScope()
        {
            string className = path + ".HrmScopeDAL";
            return (IDALHrmScope)Assembly.Load(path).CreateInstance(className);
        }

        public static IDALHrmEmployee CreateHrmEmployee()
        {
            string className = path + ".HrmEmployeeDAL";
            return (IDALHrmEmployee)Assembly.Load(path).CreateInstance(className);
        }

        public static HrmJobSiteDAL CreateHrmJobSite()
        {
            string className = path + ".HrmJobSiteDAL";
            return (HrmJobSiteDAL)Assembly.Load(path).CreateInstance(className);
        }

        //----------------------------------------------------------------------------------------------------

        
    }
}
